package cn.com.ebidding.core;

import cn.com.ebidding.core.intercepter.BraumIntercepter;
import cn.com.ebidding.core.interceptor.RememberAuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 扫地僧 (saods@ebidding.com.cn)
 * @version 1.0
 * @website https://ksp.ebidding.com.cn
 * @date 2018/11/19 9:39
 * @since 1.8
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

//    @Autowired
//    BraumIntercepter braumIntercepter;

    @Autowired
    private RememberAuthenticationInterceptor rememberAuthenticationInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(braumIntercepter)
//                .excludePathPatterns("/error/**", "favicon.ico", "/css/**", "/js/**", "/img/**")
//                .addPathPatterns("/**");
        registry.addInterceptor(rememberAuthenticationInterceptor)
                .excludePathPatterns("/passport/**", "/error/**", "/assets/**", "/css/**","/js/**","/img/**","/getKaptcha/**", "favicon.ico")
                .addPathPatterns("/**");
    }
}
